﻿--[[
   @brief    frame_bottom logic for  mianframe right bottom
   @author   harleyxwang
   @version  1.0
   @date     2016-09-13
--]]

frame_bottom_view =
{
    DELAY_GREEN_THRESHOLD = 100;
    DELAY_YELLOW_THRESHOLD = 300;
    mainframe_id_ = 0;      -- 保存经常使用的数据
    bottom_dlg_ctn_id_ = 0;
    bottom_dlg_id_ = 0;     -- 底栏对话框id
    bottom_panel_id_ = 0;
    color_text_ = "0xA4A4A4";
    color_mode_ = MainCommon.color_mode.kDark;

    status_operation_id_ = 0;
    bottom_server_info_id_ = 0;
    bottom_branch_info_id_ = 0;
    bottom_helper_area_id_ = 0;
    MINI_MARGIN_CONTENT = 25;
    MAX_MAIN_WEB_WIDTH = 1200; 
    BOTTOM_BAR_HEIGHT = 60;
    social_panel_show_mainframe_threshold = 1626;
    mainframe_banner_list_width = 190;
    social_panel_width = 253;
    helper_percent = 0.45;
    server_info_percent = 0.3;
    status_operation_percent = 0.25;

    bottom_total_percent = 1.0;
    current_select_module_id_ = GAME_ID.GAME_ID_WELL_CHOSEN;

    MENU_OFFSET_X = 12;
    MENU_OFFSET_Y = 106;

    is_english_ver = false;
    has_inited = false;
    prtcl_no_check_tips_id_ = 0;
    prtcl_no_check_tips_ptr_ = nil;
    is_protocal_tips_show_ = false;
    hidden_zone_ui_but_support = nil;
    current_cloud_game_config = {};

    game_and_plugin_state_tbl_ = {};
    -- cheat_test_mode_auto_signaled = false;

    server_info_status = {
        visible = false,
        enable = false,
        show_txt = "",
        delay_txt_status = {},
        state_icon = "",
    };

    FRAME_BOTTOM_DARK_COLOR = "COLOR:0x4d4d52;";
    FRAME_BOTTOM_LIGHT_COLOR = "COLOR:0xffffff;";
    FRAME_BOTTOM_BG_IMG = "9IMAGES:bottom_bar\\foot.png?0,0,10,10;bottom_bar\\foot.png?12,0,22,10;bottom_bar\\foot.png?24,0,34,10;bottom_bar\\foot.png?0,12,10,22;bottom_bar\\foot.png?12,12,22,22;bottom_bar\\foot.png?24,12,34,22;bottom_bar\\foot.png?0,24,10,34;bottom_bar\\foot.png?12,24,22,34;bottom_bar\\foot.png?24,24,34,34;Stretch;0;";

    init = function()
        wg_frame_bottom_view.init();
        if frame_bottom_view.has_inited then
            return;
        end;
        ierd_tgp.tpf_ui.Log("frame_bottom_view init.");
        frame_bottom_view.has_inited = true;
        comm_center.listen_broadcast("i_broadcast_mainframe_pos_change",
                                     frame_bottom_view.on_mainframe_position_change);
        if base_utility.CLIENT_TYPE.OVERSEA_VER ~= base_utility.get_client_version_type() then
            comm_center.listen_broadcast("Svr_CloudGameState", 
                                         frame_bottom_view.on_cloud_game_state_changed);
            comm_center.reg_service("Svr_TryLaunchCloudGame", 
                                         frame_bottom_view.on_try_launch_cloud_game);
        end;
        comm_center.reg_service("SvrLua_FrameBottom_QueryIsProtocalTipsShow", 
                                         frame_bottom_view.OnQueryIsProtocalTipsShow);
        comm_center.reg_service("SvrLua_FrameBottom_ShowProtocalTips", 
                                         frame_bottom_view.OnShowProtocalTips);
        comm_center.listen_broadcast("i_broadcast_game_protocol_update_suc", 
                                         frame_bottom_view.refresh_protocol_tips_status);
        comm_center.listen_broadcast("MsgTGPConfigMgr_UpdateClientMode",
                                     "frame_bottom_view.on_color_mode_update");
        frame_bottom_view.mainframe_id_ = ui_utility.get_ctrl_id_by_cid(CID_MAINFRAME_Dialog_MainFrame);
        
        local tpfui = base_utility.get_component_adapter("ITpf_ui", "ierd_tgp.tpf_ui.GetTPFUI();");
        frame_bottom_view.is_english_ver = tpfui:Is_English_ver();

        if login_model ~= nil and login_model.running_mode == login_model.OFFLINE_MODE then -- 离线模式：切换到离线模式布局的根节点
            frame_bottom_view.mainframe_id_ = ui_utility.get_ctrl_id_by_cid(CID_OFFLINE_MAIN_FRAME_DLG);
        end;
        frame_bottom_view.bottom_dlg_ctn_id_ = ui_utility.get_ctrl_id_by_path(frame_bottom_view.mainframe_id_, "pnlClient\\Ctn_BottomBar");
        frame_bottom_view.bottom_dlg_id_ = ui_utility.get_ctrl_id_by_path(frame_bottom_view.mainframe_id_, "pnlClient\\Ctn_BottomBar\\Dlg_Bottom");
        frame_bottom_view.bottom_panel_id_ = ui_utility.get_ctrl_id_by_path(frame_bottom_view.mainframe_id_, "pnlClient\\Ctn_BottomBar\\Dlg_Bottom\\Bottom_Content_Pnl");

        frame_bottom_view.status_operation_id_ = ui_utility.get_ctrl_id_by_path(frame_bottom_view.bottom_dlg_id_,
            "Bottom_Content_Pnl\\Ctn_BottomArea\\Bottom_Status_Operate_Area");
        frame_bottom_view.bottom_server_info_ctn_id_ = ui_utility.get_ctrl_id_by_path(frame_bottom_view.bottom_dlg_id_,
            "Bottom_Content_Pnl\\Ctn_BottomArea\\Bottom_ServersInfo_Area");
        frame_bottom_view.bottom_server_info_id_ = ui_utility.get_ctrl_id_by_path(
            frame_bottom_view.bottom_server_info_ctn_id_, "Bottom_ServersInfo_Ctn");
          
        frame_bottom_view.bottom_branch_info_ctn_id_ = ui_utility.get_ctrl_id_by_path(
            frame_bottom_view.bottom_dlg_id_,
            "Bottom_Content_Pnl\\Ctn_BottomArea\\Bottom_BranchInfo_Area");
        frame_bottom_view.bottom_branch_info_id_ = ui_utility.get_ctrl_id_by_path(
            frame_bottom_view.bottom_branch_info_ctn_id_, "Bottom_BranchInfo_Ctn");
        
        frame_bottom_view.bottom_helper_area_id_ = ui_utility.get_ctrl_id_by_path(frame_bottom_view.bottom_dlg_id_,
            "Bottom_Content_Pnl\\Ctn_BottomArea\\Bottom_Helper_Area");

        -- 用户协议tips
        frame_bottom_view.user_protocol_tips_ = ui_utility.get_ctrl_id_by_path(
            frame_bottom_view.mainframe_id_, "Dlg_Game_User_Protocol");
        local protocol_check_btn_ptr = ui_utility.get_ctrl_ptr_by_path(
            frame_bottom_view.mainframe_id_, "Dlg_Game_User_Protocol\\ProtocolList");
        frame_bottom_view.prtcl_no_check_tips_id_ = ui_utility.get_ctrl_id_by_path(
            frame_bottom_view.mainframe_id_, "CtnUserPrtclUnCheckTips");
        frame_bottom_view.prtcl_no_check_tips_ptr_ = ui_utility.get_ctrl_ptr_by_path(
            frame_bottom_view.mainframe_id_, "CtnUserPrtclUnCheckTips");

        local color_data_config = comm_center.call_service("SvrTGPConfigMgr_GetColorMode", {});
        if color_data_config ~= nil and color_data_config.color_mode ~=nil then
            local color_data_param = {color_mode = color_data_config.color_mode };
            frame_bottom_view.color_mode_ = color_data_config.color_mode;
            frame_bottom_view.on_color_mode_update(color_data_param);
        end;
    end;

    show_bottom = function()
        --[[local p_bottom_ctn = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.bottom_dlg_ctn_id_);
        if p_bottom_ctn ~= nil then
            p_bottom_ctn:Show(TRUE);
            frame_bottom_view.set_bottom_bar_position(true);
            frame_bottom_view.set_status_operation_area_width();
        end--]]

        local p_bottom_ctn = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.bottom_dlg_ctn_id_);
        if p_bottom_ctn ~= nil then
            p_bottom_ctn:Show(TRUE);
        end

        wg_frame_bottom_view.show_bottom_panel(frame_bottom_model.show_new_frame_bottom_);
        frame_bottom_view.show_bottom_panel(not frame_bottom_model.show_new_frame_bottom_);

        frame_bottom_view.set_bottom_bar_position(true);
        frame_bottom_view.set_status_operation_area_width();
        local color_data_config = comm_center.call_service("SvrTGPConfigMgr_GetColorMode", {});
        if color_data_config ~= nil and color_data_config.color_mode ~=nil then
            local color_data_param = {color_mode = color_data_config.color_mode };
            frame_bottom_view.on_color_mode_update(color_data_param);
        end;
    end;

    hide_bottom = function()
        local p_bottom_ctn = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.bottom_dlg_ctn_id_);
        if p_bottom_ctn ~= nil then
            p_bottom_ctn:Show(FALSE);
        end
        wg_frame_bottom_view.show_bottom_panel(false);
        frame_bottom_view.show_bottom_panel(false);
        frame_bottom_view.show_protocol_tips(false, false);
    end;

    show_bottom_panel = function(show)
        local ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.bottom_panel_id_);
        if show == true then
            if ptr ~= nil then
                --[[local need_update_pos = true;
                if ptr:IsVisible() == TRUE then
                    need_update_pos = false;
                end;--]]
                if frame_bottom_view.color_mode_ == MainCommon.color_mode.kLight then
                    ui_utility.setproperty_by_id(frame_bottom_view.bottom_dlg_id_, "Background", 
                                                 frame_bottom_view.FRAME_BOTTOM_LIGHT_COLOR);
                else
                    ui_utility.setproperty_by_id(frame_bottom_view.bottom_dlg_id_, "Background", 
                                                 frame_bottom_view.FRAME_BOTTOM_DARK_COLOR);
                end;
                
                ptr:Show(TRUE);
                --[[if need_update_pos then
                    frame_bottom_view.set_bottom_bar_position(true);
                end;
                frame_bottom_view.set_status_operation_area_width();--]]
            end
        else
            if ptr ~= nil then
                ptr:Show(FALSE);
            end
        end;
    end;

    update_bottom_style_status = function(game_id, new_style)
        if new_style == nil then
            if frame_bottom_view.state_need_show_new_frame(game_id) then
                frame_bottom_model.show_new_frame_bottom_ = true;
            else
                frame_bottom_model.show_new_frame_bottom_ = false;
            end;
        else
            frame_bottom_model.show_new_frame_bottom_ = new_style;
        end;
    end;

    is_frame_bottom_show = function()
        local is_visible = false;
        local ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.bottom_panel_id_);
        if ptr ~= nil then
            if ptr:IsVisible() == TRUE then
                is_visible = true;
            end;
        end
        return is_visible;
    end;

    -- 根据状态判断是否需要显示新底栏
    state_need_show_new_frame = function(game_id)
        if game_id == nil or game_id == 0 then
            return false;
        end;

        local game_state = banner_model.get_game_state(game_id);

        -- 是否有扩展包判断
        if game_state == nil or game_state.extension_game_state == nil or 
           game_state.extension_game_state.has_extensions == nil or 
           game_state.extension_game_state.has_extensions == false then
            return false;
        end;

        local state = game_state.iState;
        local sub_state = game_state.iSub_state;

        local ext_state = game_state.extension_game_state.iState;
        local ext_sub_state = game_state.extension_game_state.iSub_state;
        local extension_flag = game_state.extension_game_state.extension_flag;

        -- 更新状态下的判断，场景有：
        -- 子状态处于更新暂停中
        -- 子状态处于需要更新，主状态处于正常状态（基础包已安装完，扩展包需要更新）
        -- 子状态处于正在更新中
        local is_update_pause = false;
        if ext_state == ierd_tgp.game_library.GAME_STATE_NEED_UPDATE then
            local pause_status = 0;
            pause_status = frame_bottom_model.get_game_update_pause_status(game_id);
            if 0 ~= pause_status then
                is_update_pause = true;
            end;
        end;

        local only_extension_need_update = false;
        if state == ierd_tgp.game_library.GAME_STATE_NORMAL and 
           ext_state == ierd_tgp.game_library.GAME_STATE_NEED_UPDATE then
            only_extension_need_update = true;
        end;

        if is_update_pause or 
           only_extension_need_update or
           ext_state == ierd_tgp.game_library.GAME_STATE_UPDATING then
            if extension_flag == 1 then
                return true;
            end;
        end;

        -- 下载状态下的判断
        if ext_state == ierd_tgp.game_library.GAME_STATE_DOWNLOADING or 
           ext_state == ierd_tgp.game_library.GAME_STATE_DOWNLOAD_PAUSED then
            return true;
        end;

        -- 安装状态下的判断
        if ext_state == ierd_tgp.game_library.GAME_STATE_INSTALLING then
            return true;
        end;

        return false;
    end;

    check_bottom_style_status = function(new_style)
        if new_style ~= nil then
            frame_bottom_model.show_new_frame_bottom_ = new_style;
        end;
        wg_frame_bottom_view.show_bottom_panel(frame_bottom_model.show_new_frame_bottom_);
        frame_bottom_view.show_bottom_panel(not frame_bottom_model.show_new_frame_bottom_);
    end;

    set_server_info_status = function(visible, enable, show_txt, delay_txt_status, state_icon)
        if visible ~= nil then
            frame_bottom_view.server_info_status.visible = visible;
        end;

        if enable ~= nil then
            frame_bottom_view.server_info_status.enable = enable;
        end;

        if show_txt ~= nil then
            frame_bottom_view.server_info_status.show_txt = show_txt;
        end;

        if delay_txt_status ~= nil then
            frame_bottom_view.server_info_status.delay_txt_status = delay_txt_status;
        end;

        if state_icon ~= nil then
            frame_bottom_view.server_info_status.state_icon = state_icon;
        end;
    end;

    get_server_info_status = function()
        return frame_bottom_view.server_info_status;
    end;

    is_bottom_bar_show = function()
        local is_visible = FALSE;
        local p_bottom_ctn = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.bottom_dlg_ctn_id_);
        if p_bottom_ctn ~= nil then
            is_visible = p_bottom_ctn:IsVisible();
        end
        return is_visible;
    end;

    -- 获取游戏的状态
    get_current_game_state = function()
        local game_state = 0;
        if frame_bottom_view.game_and_plugin_state_tbl_ ~= nil and
            frame_bottom_view.game_and_plugin_state_tbl_.game ~= nil and
                frame_bottom_view.game_and_plugin_state_tbl_.game.status ~= nil then
            game_state = frame_bottom_view.game_and_plugin_state_tbl_.game.status;
        end
        return game_state;
    end;

    -- 进行banner切换
    switch_banner_helper = function(game_id)
        base_utility.log(string.format("[frame_bottom_view]switch_banner_helper,game_id:%s", tostring(game_id)), true);
        frame_bottom_view.current_select_module_id_ = game_id;
        frame_bottom_view.hidden_zone_ui_but_support = nil;
        local base_info = banner_model.get_game_base_info(game_id);
        if base_info == nil then  
            ierd_tgp.tpf_ui.Log("[frame_bottom_view]switch_banner_helper, base_info is nil.");     
            return;
        end;

        local game_info_tbl = {
            game_id = game_id,
            game_type = base_info.type,
            support_zone_choose = base_info.support_zone_choose,
        }; 
                  
        -- 为开发者版本的时候，处理作弊器测试模式的勾选状态
        if true == base_utility.is_develop_client() then
            frame_bottom_view.set_cheat_test_mode_check_state();
        end
        
         -- 设置助手区的状态
        local is_console_game = "false";
        if game_info_tbl.game_type == ierd_tgp.game_library.GAME_LIST_TYPE_CONSOLE then
            -- 如果是单机游戏，则显示“Cross”设置按钮
            ui_utility.setproperty_by_id(frame_bottom_view.bottom_helper_area_id_, "Visible", "true");
            frame_bottom_view.init_plugin_tool_simple_panel(
                game_id, frame_bottom_model.GAME_TYPE.STANDALONG_GAME);
            is_console_game = "true";
            -- 更新一下branch信息
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
                "CntBranchButtons\\BtnBranchDown", "Visible", "false"); 
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
                "BtnBranchDownCover", "Visible", "false"); 
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
                "CntBranchButtons\\BtnBranchUp", "Visible", "true");
        --[[
        elseif frame_bottom_model.is_super_multi_account(game_info_tbl.game_id) then
            frame_bottom_view.init_plugin_tool_simple_panel(
                game_id, frame_bottom_model.GAME_TYPE.OTHER);
        ]]
        else
            ui_utility.setproperty_by_id(frame_bottom_view.bottom_helper_area_id_, "Visible", "true");
            frame_bottom_view.init_plugin_tool_panel(game_id);
        end
        -- 设置游戏区服状态
        if game_info_tbl.support_zone_choose then
             ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
                "CntZoneButtons\\BtnZoneDown", "Visible", "false"); 
             ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
                "CntZoneButtons\\BtnZoneUp", "Visible", "true");
        end

        ui_utility.setproperty_by_id(frame_bottom_view.bottom_branch_info_id_,
            "Visible", "false");
        frame_bottom_view.handle_update_branch_info_by_game_id(game_id);
        
        frame_bottom_view.set_server_info_state_helper(game_id, game_info_tbl.support_zone_choose);
        -- 切换时，隐藏礼包功能
        gift_op_panel.hide_gift_icon();
        frame_bottom_view.show_contract_no_check_tips(false);
        --[[ lcu remove
        frame_bottom_view.hide_lcu_btn();
        ]]

        wg_frame_bottom_view.switch_banner_helper(game_id);
    end;

    set_server_info_state_helper = function(game_id, support_choose_param, game_state_param)
        local support_zone_choose = support_choose_param;
        if support_zone_choose == nil then
            local base_info = banner_model.get_game_base_info(game_id);
            if base_info ~= nil then  
                support_zone_choose = base_info.support_zone_choose;
            end;
        end
        local state_value = game_state_param;
        if state_value == nil then
            local game_state = banner_model.get_game_state(game_id);
            if game_state ~= nil and game_state.iState ~= nil then
                state_value = game_state.iState;
            end
        end

        if frame_bottom_view.is_branch_btn_need_show(game_id) then
            ui_utility.setproperty_by_id(frame_bottom_view.bottom_branch_info_id_, "Visible", "true");
        else
            ui_utility.setproperty_by_id(frame_bottom_view.bottom_branch_info_id_, "Visible", "false");
        end
        
        local support_cloud_game = false;
        local data = comm_center.call_service("Svr_IsOpenCloudGaming", 
                                   { game_id = frame_bottom_view.current_select_module_id_ });
        if nil ~= data and true == data.is_open then
            support_cloud_game = true;
        end

        if support_zone_choose then
            if state_value == ierd_tgp.game_library.GAME_STATE_NOT_INSTALLED and 
               true ~= support_cloud_game then
                frame_bottom_view.show_server_zone_select_ui(false);
                frame_bottom_view.hidden_zone_ui_but_support = true;
                frame_bottom_view.set_server_info_status(false, false);
            else
                frame_bottom_view.show_server_zone_select_ui(true);
                frame_bottom_view.set_status_operation_area_width();
                if ierd_tgp.game_library.GAME_STATE_SELECTING_SERVER == state_value or
                    ierd_tgp.game_library.GAME_STATE_LAUNCHING == state_value or 
                    ierd_tgp.game_library.GAME_STATE_RUNNING == state_value or
                    ierd_tgp.game_library.GAME_STATE_INSTALLING == state_value or
                    ierd_tgp.game_library.GAME_STATE_UNINSTALLING == state_value then
                    ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
                        "CntZoneButtons", "Disable", "true");
                    frame_bottom_view.set_server_info_status(true, false);
                else
                    ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
                        "CntZoneButtons", "Disable", "false");
                    frame_bottom_view.set_server_info_status(true, true);
                end     
            end
        else
            frame_bottom_view.show_server_zone_select_ui(false);
            frame_bottom_view.set_server_info_status(false, false);
        end 
    end;
    -- 判断是否需要刷新底栏
    is_need_refresh_bottom = function(new_param_tbl)
        -- 如果是不同游戏，则需要刷新
        local pre_game_id = 0;
        local new_game_id = 0;
        if nil ~= frame_bottom_view.game_and_plugin_state_tbl_ then 
            pre_game_id = frame_bottom_view.game_and_plugin_state_tbl_.gameid;
        end
        if nil ~= new_param_tbl then
            new_game_id = new_param_tbl.gameid;
        end

        if new_game_id ~= pre_game_id then
            return true;
        end
       
         
        local need_refresh = false;
        -- 如果游戏状态或者插件状态不同，则需要刷新
        local pre_game_state = 0;
        local new_game_state = 0;
        if frame_bottom_view.game_and_plugin_state_tbl_ ~= nil and
            frame_bottom_view.game_and_plugin_state_tbl_.game ~= nil then
            pre_game_state = frame_bottom_view.game_and_plugin_state_tbl_.game.status;
        end
        if new_param_tbl ~= nil and new_param_tbl.game ~= nil then
            new_game_state = new_param_tbl.game.status;
        end
        -- 如果游戏状态是需要更新，则也刷新，因为暂停更新和需要更新是同一个状态值
        if new_game_state == ierd_tgp.game_library.GAME_STATE_NEED_UPDATE then
            return true;
        end

        local pre_plugin_state = 0;
        local new_plugin_state = 0;
        if frame_bottom_view.game_and_plugin_state_tbl_ ~= nil and
            frame_bottom_view.game_and_plugin_state_tbl_.plugin ~= nil then
            pre_plugin_state = frame_bottom_view.game_and_plugin_state_tbl_.plugin.status;
        end
        if new_param_tbl ~= nil and new_param_tbl.plugin ~= nil then
            new_plugin_state = new_param_tbl.plugin.status;
        end
        if pre_game_state ~= new_game_state or pre_plugin_state ~= new_plugin_state then
            need_refresh = true;
        else
            need_refresh = false;
        end
        return need_refresh;
    end;

    update_game_or_plugin_state = function(param_tbl)
        if nil == param_tbl then return end
        local is_need_refresh = frame_bottom_view.is_need_refresh_bottom(param_tbl);

        frame_bottom_view.game_and_plugin_state_tbl_ = param_tbl;

        frame_bottom_view.update_bottom_style_status(param_tbl.gameid);

        if frame_bottom_view.is_show_plugin_panel() then
            -- 优先显示插件状态
            frame_bottom_view.check_bottom_style_status(false);
            state_operation_panel.show_plugin_status_text(param_tbl.plugin.status, param_tbl.plugin.progress); 
            frame_bottom_view.show_protocol_tips(false);
        else
            frame_bottom_view.check_bottom_style_status();
            local plugin_state = 0;
            if param_tbl.plugin ~= nil and param_tbl.plugin.status ~= nil then
                plugin_state = param_tbl.plugin.status;
            end
            if ierd_tgp.game_library.KUPDATEFAIL == plugin_state then  -- 更新失败，显示开始游戏按钮
                state_operation_panel.set_helper_area_enable_state(FALSE);
            end
            if param_tbl.game == nil then
                ierd_tgp.tpf_ui.Log("[frame_bottom_view]update_game_or_plugin_state, param_tbl.game is nil, game_id="..frame_bottom_view.current_select_module_id_, true); 
                return 
            end
            local state_value = param_tbl.game.status;
            if banner_model.is_netbar == 1 and
                state_value == ierd_tgp.game_library.GAME_STATE_NOT_INSTALLED then
                state_value = ierd_tgp.game_library.GAME_STATE_NORMAL;
            end
            -- 游戏显示游戏状态
            state_operation_panel.show_game_status_text(param_tbl.game);
            frame_bottom_view.set_server_info_state_helper(param_tbl.game.game_id, nil, state_value);
            if state_value ~= ierd_tgp.game_library.GAME_STATE_NORMAL then
                frame_bottom_view.show_protocol_tips(false);
            end
        end

        if is_need_refresh then
            frame_bottom_view.refresh_bottom_area(nil);
            frame_bottom_view.set_update_post_state();
        end

        wg_frame_bottom_view.update_game_or_plugin_state(param_tbl);
    end;

    set_helper_area_visible_state = function(game_info_param)
        if game_info_param == nil then return end
        local game_type = game_info_param.game_type;
        ui_utility.setproperty_by_id(frame_bottom_view.bottom_helper_area_id_, "Visible", "true");
        if ierd_tgp.game_library.GAME_LIST_TYPE_CONSOLE == game_type then
            frame_bottom_view.init_plugin_tool_simple_panel(game_info_param.game_id, 
                frame_bottom_model.GAME_TYPE.STANDALONG_GAME);
        --[[
        elseif frame_bottom_model.is_super_multi_account(game_info_param.game_id)then 
            frame_bottom_view.init_plugin_tool_simple_panel(
                game_info_param.game_id, frame_bottom_model.GAME_TYPE.OTHER);
        ]]
        else
            frame_bottom_view.init_plugin_tool_panel(game_info_param.game_id);
        end
    end;

    -- 是否显示插件
    is_show_plugin_panel = function()
        if nil == frame_bottom_view.game_and_plugin_state_tbl_ then
            return false;
        end
        local game_priority = 0;
        local plugin_priority = 0;
        local plugin_state = 0;
        if frame_bottom_view.game_and_plugin_state_tbl_.game ~= nil and
            frame_bottom_view.game_and_plugin_state_tbl_.game.priority ~= nil then
            game_priority = frame_bottom_view.game_and_plugin_state_tbl_.game.priority;
        end
        if frame_bottom_view.game_and_plugin_state_tbl_.plugin ~= nil and
            frame_bottom_view.game_and_plugin_state_tbl_.plugin.priority ~= nil then
            plugin_priority = frame_bottom_view.game_and_plugin_state_tbl_.plugin.priority;
        end
        if frame_bottom_view.game_and_plugin_state_tbl_.plugin ~= nil and
            frame_bottom_view.game_and_plugin_state_tbl_.plugin.status ~= nil then
            plugin_state = frame_bottom_view.game_and_plugin_state_tbl_.plugin.status;
        end
        if plugin_priority > game_priority and plugin_state ~= ierd_tgp.game_library.KUPDATEFAIL then
            return true;
        else
            return false;
        end
    end;
    -- server info相关处理函数
    update_game_servers_info = function(game_servers_tbl)
         frame_bottom_view.set_current_server_info_state(game_servers_tbl);
         comm_center.call_service("i_service_refresh_operate_menu", {});
    end;
    -- 设置当前服务器信息的状态
    set_current_server_info_state = function(game_servers_tbl)
        local enable = false;
        local show_txt = "";
        local delay_txt_status = {};
        local state_icon = "";

        -- 首先判断游戏的状态：
        -- b. 如果游戏正在选区或者运行中，则不能选区（disable掉）
        local state_value = frame_bottom_view.get_current_game_state();
        if ierd_tgp.game_library.GAME_STATE_SELECTING_SERVER == state_value or
            ierd_tgp.game_library.GAME_STATE_LAUNCHING == state_value or 
            ierd_tgp.game_library.GAME_STATE_RUNNING == state_value or 
            ierd_tgp.game_library.GAME_STATE_INSTALLING == state_value or
            ierd_tgp.game_library.GAME_STATE_UNINSTALLING == state_value then
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
                "CntZoneButtons", "Disable", "true");
        else
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
                "CntZoneButtons", "Disable", "false");
            enable = true;
        end

        local server_info = frame_bottom_view.get_select_server_info(game_servers_tbl);
        
        --[[ lcu remove
        if game_servers_tbl ~= nil and game_servers_tbl.game_id == 26 
            and game_servers_tbl.selleted ~= 0 
            and frame_bottom_model.cur_lol_server_id ~= game_servers_tbl.selleted then
            local game_lib = base_utility.get_component_adapter("IGame_library",
                "ierd_tgp.game_library.Get_game_library_adapter();");
            if game_lib ~= nil then
                frame_bottom_model.cur_lol_server_id = game_servers_tbl.selleted;
                game_lib:UpdateLcuServerSelected(game_servers_tbl.game_id, game_servers_tbl.selleted);
            end
        end
        ]]

        if server_info ~= nil then
            delay_txt_status = frame_bottom_view.set_delay_txt(server_info.acce_info);
            state_icon = frame_bottom_view.set_server_state_icon_background(server_info.state);
            show_txt = server_info.name;

            -- 对文件名进行截断处理
            local is_need_cut_name = ui_utility.is_over_char_count(server_info.name, 12);
            if true == is_need_cut_name then
                ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "ZoneName", "AutoSize", "false");
                ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "ZoneName", "Width", "150");
            else
                ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "ZoneName", "AutoSize", "true");
            end
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "ZoneName",
                    "Caption", server_info.name);
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "ZoneName",
                    "TextColor", frame_bottom_view.color_text_);
        else
            if game_servers_tbl.selleted ~= 0 then
                -- 选择了大区，但是区服信息没有拉取成功，显示大区id(未知的区服名)
                local zone_name = string.format("%d(%s)", game_servers_tbl.selleted, LoadStr("FRAME_BOTTOM_UNKNOWN_ZONE"));
                ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "ZoneName",
                    "Caption", zone_name);

                show_txt = zone_name;
            else
                frame_bottom_view.set_server_info_no_select_state();

                state_icon = "ONEIMAGE:main_bottom_button\\frame_bottom.png?136,211,142,217;Center;null;";
                show_txt = LoadStr("FRAME_BOTTOM_NOT_SELECT_ZONE");
            end
        end
        frame_bottom_view.set_server_info_status(nil, enable, show_txt, delay_txt_status, state_icon);
    end;
    -- 设置服务器不可选择状态
    set_server_info_no_select_state = function()
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "delayTime",
            "Visible", "false");
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "CntIcons",
            "Background", "ONEIMAGE:main_bottom_button\\frame_bottom.png?136,211,142,217;Center;null;");
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "ZoneName",
            "Caption", LoadStr("FRAME_BOTTOM_NOT_SELECT_ZONE")); 
    end;
    -- 获取当前选择的服务器信息
    get_select_server_info = function(game_servers_tbl)
        local server_info = nil;
        if game_servers_tbl ~= nil then
            local select_area_id = game_servers_tbl.selleted;
            for i, item_node in pairs(game_servers_tbl.servers) do
                if select_area_id == item_node.id then
                    server_info = item_node;
                    break;
                end
            end
        end
        return server_info;
    end;

    -- 设置服务器的状态icon（0：维护，1：良好，2：爆满，3：拥塞）
    set_server_state_icon_background = function(state)
        local icon_background = "ONEIMAGE:bottom_bar\\server_state_green.png;Stretch;0;";
        if state == 0 then
            icon_background = "ONEIMAGE:bottom_bar\\server_state_gray.png;Stretch;0;";
        elseif state == 1 then
            icon_background = "ONEIMAGE:bottom_bar\\server_state_green.png;Stretch;0;";
        elseif state == 2 then
            icon_background = "ONEIMAGE:bottom_bar\\server_state_orange.png;Stretch;0;";
        elseif state == 3 then
            icon_background = "ONEIMAGE:bottom_bar\\server_state_red.png;Stretch;0;";
        end
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "CntIcons",
            "Background", icon_background);
        return icon_background;
    end;

    get_acce_status = function(acce_info)
        local use_proxy = false;
        if acce_info.decision_code == 0 or acce_info.decision_code == 4 or
            acce_info.decision_code == 8 then
            use_proxy = true;
        end;

        local display_delay = acce_info.proxy_delay_raw_t1 + acce_info.proxy_delay_raw_t2;
        if use_proxy == false then
            display_delay = acce_info.direct_delay_raw;
        end;
        if acce_info.real_ping ~= -1 then
             display_delay = acce_info.real_ping;
        end

        local display_delay_txt = display_delay .. 'ms';
        if display_delay > 999 then
            display_delay_txt = '>40ms';
        end;
        return use_proxy, display_delay, display_delay_txt;
    end;

    set_delay_txt = function(acce_info)
        local delay_txt_status = {
            visible = false,
            color = "",
            text = "",
        };

        if acce_info.valid ~= 1 then
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "delayTime",
            "Visible", "false");
            return delay_txt_status;
        end
        if frame_bottom_view.game_and_plugin_state_tbl_ ~= nil and
            frame_bottom_view.game_and_plugin_state_tbl_.game ~= nil and
                frame_bottom_view.game_and_plugin_state_tbl_.game.status ~= nil then
            local state_value = frame_bottom_view.game_and_plugin_state_tbl_.game.status;
            if ierd_tgp.game_library.GAME_STATE_NOT_INSTALLED == state_value then
                ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "delayTime",
                    "Visible", "false");
            else
                -- jameszhai: 天刀不显示PING值
                local   zParam = {};

                zParam["game_id"] = frame_bottom_view.game_and_plugin_state_tbl_.game.game_id;

                local zTemp = comm_center.call_service("Svr_IsXGame", zParam);

                if (nil ~= zTemp["is_xgame"]) and (0 ~= zTemp["is_xgame"]) then
                    ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "delayTime",
                        "Visible", "false");
                else
                    ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "delayTime",
                        "Visible", "true");
                    delay_txt_status.visible = true;
                end;
            end
        end

        local use_proxy, display_delay, display_delay_txt =
            frame_bottom_view.get_acce_status(acce_info);
        local state_color = "RGB:1,164,41";
        if display_delay < frame_bottom_view.DELAY_GREEN_THRESHOLD then
            state_color = "RGB:1,164,41";
        elseif  display_delay <  WGSelectZoneItem.DELAY_YELLOW_THRESHOLD then
            state_color = "RGB:250,171,0";
        else
            state_color = "RGB:255,0,0";
        end
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "delayTime",
            "TextColor", state_color);
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "delayTime",
            "TextColorHover", state_color);
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "delayTime",
            "TextColorPressed", state_color);
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "delayTime", 
            'Caption', display_delay_txt);
        -- 设置tips
        local tip_text = '';
        if use_proxy == true then
             tip_text = '<f c="0xfefefe">' .. LoadStr("FRAME_BOTTOM_NETWORK_ENGINE_OPENED") .. '</f><br><f c="0xfefefe">' .. LoadStr("FRAME_BOTTOM_NETWORK_CLICK_FOR_DETAIL") .. '</f>';
        else
             tip_text = '<f c="0xfefefe">' .. LoadStr("FRAME_BOTTOM_NETWORK_ENGINE_CLOSED") .. '</f><br><f c="0xfefefe">' .. LoadStr("FRAME_BOTTOM_NETWORK_CLICK_FOR_DETAIL") .. '</f>';
        end
        -- ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "delayTime", 'Tip', tip_text);
        delay_txt_status.color = state_color;
        delay_txt_status.text = display_delay_txt;
        return delay_txt_status;
    end;
    -- 事件处理
    on_right_btn_click = function()
        --[[ lcu remove
        if frame_bottom_view.current_select_module_id_ == GAME_ID.GAME_ID_LOL then
            frame_bottom_view.hide_lcu_btn();
        end
        ]]
        if frame_bottom_view.is_show_plugin_panel() then
            state_operation_panel.click_right_btn_plugin_action();
        else
            state_operation_panel.click_right_btn_game_action();
        end
    end;

    on_left_btn_click = function()
        if frame_bottom_view.is_show_plugin_panel() then
            -- 没有暂时和继续操作
        else
            state_operation_panel.click_left_btn_game_action();
        end
    end;
    on_link_btn_click = function()
        local url = frame_bottom_view.game_and_plugin_state_tbl_.game.update_post_url;
        base_utility.log("[frame_bottom][on_link_btn_click]url = " .. tostring(url));
        if url ~= nil then
            web_utility.open_link(url);
        end
    end;
    
    --显示礼包
    on_gift_btn_click = function ()
        if not frame_bottom_view.is_show_plugin_panel() then
            state_operation_panel.click_gift_btn_action();
        end    
    end;

    -- 能否打开选区界面
    is_allow_select_zone = function()
        local is_allow = true;
        if frame_bottom_view.game_and_plugin_state_tbl_ ~= nil and
            frame_bottom_view.game_and_plugin_state_tbl_.game ~= nil and
                frame_bottom_view.game_and_plugin_state_tbl_.game.status ~= nil then
            local state_value = frame_bottom_view.game_and_plugin_state_tbl_.game.status;
            if  ierd_tgp.game_library.GAME_STATE_NOT_INSTALLED == state_value or
                ierd_tgp.game_library.GAME_STATE_SELECTING_SERVER == state_value or
                ierd_tgp.game_library.GAME_STATE_INSTALLING == state_value or
                ierd_tgp.game_library.GAME_STATE_UNINSTALLING == state_value or
                ierd_tgp.game_library.GAME_STATE_LAUNCHING == state_value or 
                ierd_tgp.game_library.GAME_STATE_RUNNING == state_value then
                is_allow = false;
            end

            if ierd_tgp.game_library.GAME_STATE_NOT_INSTALLED == state_value then
                local data = comm_center.call_service("Svr_IsOpenCloudGaming", 
                                   { game_id = frame_bottom_view.current_select_module_id_ });
                if nil ~= data and true == data.is_open then
                    is_allow = true;
                end
            end
        end

        return is_allow;
    end;

    is_allow_select_branch = function()
        local is_allow = true;
        if frame_bottom_view.game_and_plugin_state_tbl_ ~= nil and
            frame_bottom_view.game_and_plugin_state_tbl_.game ~= nil and
                frame_bottom_view.game_and_plugin_state_tbl_.game.status ~= nil then
            local state_value = frame_bottom_view.game_and_plugin_state_tbl_.game.status;
            if  ierd_tgp.game_library.GAME_STATE_INSTALLING == state_value or
                ierd_tgp.game_library.GAME_STATE_UNINSTALLING == state_value or
                ierd_tgp.game_library.GAME_STATE_LAUNCHING == state_value or 
                ierd_tgp.game_library.GAME_STATE_RUNNING == state_value then
                is_allow = false;
            end
        end
        return is_allow;
    end;

    -- 点击服务器信息区的选区按钮
    on_btn_select_zone_click = function()
        local support_zone_choose = false;
        local base_info = banner_model.get_game_base_info(frame_bottom_view.current_select_module_id_);
        if base_info ~= nil then  
            support_zone_choose = base_info.support_zone_choose;
        end;
        if not support_zone_choose then
            return;
        end
        local ptr_btn_zone_down = ui_utility.get_ctrl_ptr_by_path(frame_bottom_view.bottom_server_info_id_, "CntZoneButtons\\BtnZoneDown");
        if ptr_btn_zone_down ~= nil then
            if ptr_btn_zone_down:IsVisible() == TRUE then
                -- 显示了向下的按钮
                base_utility.log("[frame_bottom][on_btn_select_zone_click],down click");
                frame_bottom_view.on_btn_zone_down_click();
            else
                -- 显示了向上的按钮,打开区服
                base_utility.log("[frame_bottom][on_btn_select_zone_click],up click");
                frame_bottom_view.on_btn_zone_up_click();
            end
        end
    end;

    on_btn_select_branch_click = function()
        frame_bottom_view.on_btn_branch_up_click();
    end;
    
    -- 点击服务器信息区的下拉按钮
    on_btn_zone_down_click = function()
        -- 某些游戏状态不能点击
        if not frame_bottom_view.is_allow_select_zone() then
            return
        end
        WGSelectZoneList.hide();
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
            "CntZoneButtons\\BtnZoneDown", "Visible", "false"); 
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
            "CntZoneButtons\\BtnZoneUp", "Visible", "true"); 
    end;

    on_btn_branch_down_click = function()
        NURailBranchList.hide();
        -- 某些游戏状态不能点击
        if not frame_bottom_view.is_allow_select_branch() then
            return
        end

        ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
            "CntBranchButtons\\BtnBranchDown", "Visible", "false"); 
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
            "BtnBranchDownCover", "Visible", "false");
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
            "CntBranchButtons\\BtnBranchUp", "Visible", "true"); 
    end;
    on_btn_zone_up_click = function()
        -- 某些游戏状态不能点击
        if not frame_bottom_view.is_allow_select_zone() then
            return
        end
        if frame_bottom_view.game_and_plugin_state_tbl_ == nil or
            frame_bottom_view.game_and_plugin_state_tbl_.game == nil then
            return
        end

        local game_id = frame_bottom_view.game_and_plugin_state_tbl_.game.game_id;
        local control_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.bottom_server_info_id_);
        local rc = nil;
        if control_ptr ~= nil then
            rc = control_ptr:GetRectEx(TRUE,TRUE);
        end
        if rc ~= nil then 
            WGSelectZoneList.init(WGSelectZoneList.LIST_TYPE.FOR_PLUGIN_PAGE);
            WGSelectZoneList.show(rc.left, rc.top, game_id);
        end
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
            "CntZoneButtons\\BtnZoneUp", "Visible", "false");
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
            "CntZoneButtons\\BtnZoneDown", "Visible", "true");  
    end;

    on_btn_branch_up_click = function()
        -- 某些游戏状态不能点击
        if not frame_bottom_view.is_allow_select_branch() then
            return
        end
        local game_id = frame_bottom_view.game_and_plugin_state_tbl_.game.game_id;
        local control_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.bottom_branch_info_id_);
        local rc = nil;
        if control_ptr ~= nil then
            rc = control_ptr:GetRectEx(TRUE,TRUE);
        end
        if rc ~= nil then 
            NURailBranchList.init();
            NURailBranchList.show(rc.left, rc.top, game_id);
        end
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
            "CntBranchButtons\\BtnBranchUp", "Visible", "false");
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
            "CntBranchButtons\\BtnBranchDown", "Visible", "true");
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
            "BtnBranchDownCover", "Visible", "true");
    end;

    -- 点击查看加速详情
    on_btn_acce_info_click = function()
        local param ={};
        param["type"] = "tools";
        param["sub_page"] = "NET_ACCE";
        param["game_id"] = 0;
        web_utility.open_link(base_utility.table_to_json(param));
    end;

    on_mainframe_position_change = function()
    --[[ lcu remove
        frame_bottom_view.hide_lcu_btn();    -- 隐藏lcu按钮
        ]]
        frame_bottom_view.refresh_bottom_area(nil);
        WGSelectZoneList.hide();
        frame_bottom_view.set_gift_icon_position();
        NURailBranchList.hide();
        if frame_bottom_model.is_all_protocol_agree(frame_bottom_view.current_select_module_id_) then
            frame_bottom_view.show_protocol_tips(false);
        end
        
        local menu_id = ui_utility.get_ctrl_id_by_path(wegame_mainframe_view.dialog_id, "WinMenu_ISP");
        local color_data_config = comm_center.call_service("SvrTGPConfigMgr_GetColorMode", {});
        if color_data_config ~= nil and color_data_config.color_mode ~=nil and 
            color_data_config.color_mode== MainCommon.color_mode.kLight then
            menu_id = ui_utility.get_ctrl_id_by_path(wegame_mainframe_view.dialog_id, "WinMenu_LightISP");
        end;

        tiandao_isp_menu.hide_animation(menu_id);

        frame_bottom_view.move_proticol_tips();

        wg_frame_bottom_view.on_mainframe_position_change();
    end;

    refresh_bottom_area = function(show_param)  -- 如果传递的参数为空，则函数内部自己获取
        -- 先判断底栏是否显示
        local p_bottom_content = ui_utility.get_ctrl_ptr_by_path(frame_bottom_view.bottom_dlg_id_, "Bottom_Content_Pnl");
        if p_bottom_content ~= nil and TRUE == p_bottom_content:IsVisible() then
             --frame_bottom_view.set_bottom_content_width(show_param);
             frame_bottom_view.set_status_operation_area_width();
        end
    end;

    set_update_post_state = function()
        if frame_bottom_view.current_select_module_id_ == plugin_tool_panel.cur_game_id then
            plugin_tool_panel.set_version_post_state();
        elseif frame_bottom_view.current_select_module_id_ == plugin_tool_simple_panel.cur_game_id then
            plugin_tool_simple_panel.set_version_post_state();
        end
    end;

    get_cur_tool_panel = function()
        if frame_bottom_view.current_select_module_id_ == plugin_tool_panel.cur_game_id then
            return plugin_tool_panel;
        elseif frame_bottom_view.current_select_module_id_ == plugin_tool_simple_panel.cur_game_id then
            return plugin_tool_simple_panel;
        end
    end;

    set_bottom_content_width = function(show_param)
        local mainframe_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.mainframe_id_);
        if mainframe_ptr ~= nil then
            local rc_mainframe = mainframe_ptr:GetRectEx(FALSE,TRUE);
             -- 获取主面板的宽度
            local width_mainframe = rc_mainframe.right - rc_mainframe.left;
            -- 计算web的宽度
            local main_web_width = width_mainframe;  -- frame_bottom_view.mainframe_banner_list_width;
       
            local x_offset =  frame_bottom_view.MINI_MARGIN_CONTENT;
            local bottom_width = main_web_width - 2 * x_offset;
            if main_web_width > frame_bottom_view.MAX_MAIN_WEB_WIDTH then
                local web_content_width = frame_bottom_view.MAX_MAIN_WEB_WIDTH - 2 * frame_bottom_view.MINI_MARGIN_CONTENT; -- 1150
                local is_show = show_param;
                if is_show == nil then
                    local data = comm_center.call_service('i_service_social_mainwnd_is_shown', {});
                    is_show =  data.is_show;
                end
                if is_show == 1 and width_mainframe >= frame_bottom_view.social_panel_show_mainframe_threshold then
                    x_offset = math.floor((main_web_width - web_content_width - frame_bottom_view.social_panel_width) / 2);
                else
                    x_offset = math.floor((main_web_width - web_content_width) / 2);
                end
                bottom_width = web_content_width;
            end
            -- 设置底栏的位置
            local bottom_content_id = ui_utility.get_ctrl_id_by_path(frame_bottom_view.bottom_dlg_id_, "Bottom_Content_Pnl");
            ui_utility.setproperty_by_id(bottom_content_id, 'XOffset', '0');
            ui_utility.setproperty_by_id(bottom_content_id, 'Width', tostring(bottom_width));
        end     
    end;

    init_plugin_tool_panel = function (game_id)
        if 0 ~= frame_bottom_view.bottom_helper_area_id_ then
            plugin_tool_panel.init(frame_bottom_view.bottom_helper_area_id_, game_id);
        end
        plugin_tool_simple_panel.reset_game_id();
    end;

    init_plugin_tool_simple_panel = function (game_id, game_type)
        if 0 ~= frame_bottom_view.bottom_helper_area_id_ then
            plugin_tool_simple_panel.init(frame_bottom_view.bottom_helper_area_id_, game_id, game_type);
        end
        plugin_tool_panel.reset_game_id();
    end;

    set_status_operation_area_width = function() 
        local server_info_visible = frame_bottom_view.is_server_info_show();
        if server_info_visible == TRUE or frame_bottom_view.is_branch_btn_need_show(nil) then
            ui_utility.setproperty_by_id(frame_bottom_view.status_operation_id_, 
                'Width', '265');
        else
            ui_utility.setproperty_by_id(frame_bottom_view.status_operation_id_, 
                'Width', '544');
        end
    end;

    is_helper_area_show = function()
        local helper_visible = FALSE;
        local ptr_helper = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.bottom_helper_area_id_);
        if ptr_helper ~= nil then
            helper_visible = ptr_helper:IsVisible();
        end
        return helper_visible;
    end;

    is_server_info_show = function()
        local server_info_visible = FALSE;
        local ptr_server_info = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.bottom_server_info_id_);
        if ptr_server_info ~= nil then
            server_info_visible = ptr_server_info:IsVisible();
        end
        return server_info_visible;
    end;

    is_branch_btn_need_show = function(game_id)
        local branch_btn_visible = false;
        return branch_btn_visible;
    end;

    is_status_operation_show = function()
        local status_visible = FALSE;
        local ptr_status = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.status_operation_id_);
        if ptr_status ~= nil then
            status_visible = ptr_status:IsVisible();
        end
        return status_visible;
    end;

    is_start_update_button_show = function()
        local start_update_visible = FALSE;
        local p_start_update_btn = ui_utility.get_ctrl_ptr_by_path(
            frame_bottom_view.status_operation_id_, "StateOperationCnt");
        if p_start_update_btn ~= nil then
            start_update_visible = p_start_update_btn:IsVisible();
        end
        return start_update_visible;
    end;

    handle_zone_list_show = function (event_id, json_str)
        base_utility.log("[frame_bottom_view]handle_zone_list_show");

        local zone_list_show = base_utility.json_to_table(json_str);
        if zone_list_show == nil then
            return;
        end;
        if zone_list_show.show then
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
                "CntZoneButtons\\BtnZoneUp", "Visible", "false");
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
                "CntZoneButtons\\BtnZoneDown", "Visible", "true");  
        else
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
                "CntZoneButtons\\BtnZoneDown", "Visible", "false"); 
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
                "CntZoneButtons\\BtnZoneUp", "Visible", "true"); 
        end
    end;

    -- 响应菜单显示消失的事件,切换arrow方向
    handle_branch_list_show = function (event_id, json_str)
        base_utility.log("[frame_bottom_view]handle_branch_list_show");

        local branch_list_show = base_utility.json_to_table(json_str);
        if branch_list_show == nil then
            return;
        end;

        --NURailBranch.set_expanded
        if branch_list_show.is_show then
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
                "CntBranchButtons\\BtnBranchUp", "Visible", "false");
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
                "CntBranchButtons\\BtnBranchDown", "Visible", "true");  
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
                "BtnBranchDownCover", "Visible", "true");  
        else
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
                "CntBranchButtons\\BtnBranchDown", "Visible", "false"); 
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
                "BtnBranchDownCover", "Visible", "false"); 
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_branch_info_id_, 
                "CntBranchButtons\\BtnBranchUp", "Visible", "true"); 
        end
    end;

    notify_page_branch_info = function(infos)
        base_utility.log("[frame_bottom_view][notify_page_branch_info]");
        local callback_func = web_register_center.get_func_by_browser(
            "notify_page_branch_info_event", CID_MAINFRAME_QBWEB);

        if callback_func ~= nil and callback_func ~= "" then
            local rsp_data_table = web_utility.notify_event_comm_data("notify_page_branch_info_event");
            rsp_data_table.data.branch_infos = infos;
            web_utility.lua_call_js_ex(callback_func, 
                    base_utility.table_to_json(rsp_data_table), CID_MAINFRAME_QBWEB);
        end
    end;
    
    handle_update_branch_info = function(event_id, json_str)
        base_utility.log("[frame_bottom_view]handle_update_branch_info");
        local data = base_utility.json_to_table(json_str);
        if data == nil or data.game_id == nil then
            return;
        end;

        if data.cur_branch_id == nil then
            frame_bottom_view.handle_update_branch_info_by_game_id(data.game_id);
        else
            frame_bottom_view.handle_update_branch_info_by_info(data);
        end
    end;
    
    handle_update_branch_info_by_game_id = function(game_id)
        NURailBranch.init(game_id);
        local infos = frame_bottom_model.get_all_branch_infos(game_id);
        frame_bottom_view.handle_update_branch_info_by_info(infos);
    end;
    
    handle_update_branch_info_by_info = function(infos)
        -- 通知web更新
        frame_bottom_view.notify_page_branch_info(infos);
        
        local game_id = infos.game_id;
        NURailBranch.init(game_id);
      
        local base_info = banner_model.get_game_base_info(game_id);
        if infos.count <= 1 or ierd_tgp.game_library.GAME_LIST_TYPE_CONSOLE == base_info.type then 
            frame_bottom_view.update_branch_info(infos);
        else
            ui_utility.setproperty_by_id(frame_bottom_view.bottom_branch_info_id_, 
                "Visible", "false"); 
            NURailBranch.show(false);
        end;
    end;
    update_branch_info = function(infos)
        if infos.count == nil or infos.count <= 1 then
            -- 隐藏选择分支
            NURailBranch.show(false);
            ui_utility.setproperty_by_id(frame_bottom_view.bottom_branch_info_id_, 
                "Visible", "false"); 
        else
            NURailBranch.show(true);
            -- 设置并显示选择分支
            local local_valid  = false;
            for _, info in ipairs(infos.info) do
                if info.branch_id == infos.cur_branch_id then
                    base_utility.log(string.format("[NURailBranchList][refresh_list]set branch info (%d, %s)",
                                      info.branch_id, info.app_name));
                    NURailBranch.set_branch_name(info.app_name, info.status == -1);
                    local_valid = true;
                end
            end
            NURailBranch.set_local_valid(local_valid);
            ui_utility.setproperty_by_id(frame_bottom_view.bottom_branch_info_id_, 
                "Visible", "false");
        end
    end;

    set_bottom_background = function(game_id)
        local module_info = banner_model.get_banner_module_info_by_game_id(game_id);
        local bottom_color = frame_bottom_model.def_module_color;
        if module_info ~= nil and module_info.bottom_background_color ~= nil and
            module_info.bottom_background_color ~= "" then
            bottom_color = module_info.bottom_background_color;
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_helper_area_id_, 
                "PluginToolPanelCtn",'Alpha', '255');
            ui_utility.setproperty_by_id(frame_bottom_view.bottom_server_info_ctn_id_, 'Alpha', '255');
            ui_utility.setproperty_by_id(frame_bottom_view.bottom_branch_info_ctn_id_, 'Alpha', '255');
            ui_utility.setproperty_by_id(frame_bottom_view.status_operation_id_, 'Alpha', '255'); 
        else
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_helper_area_id_, 
                "PluginToolPanelCtn",'Alpha', '25');
            ui_utility.setproperty_by_id(frame_bottom_view.bottom_server_info_ctn_id_, 'Alpha', '25');
            ui_utility.setproperty_by_id(frame_bottom_view.bottom_branch_info_ctn_id_, 'Alpha', '25');
            ui_utility.setproperty_by_id(frame_bottom_view.status_operation_id_, 'Alpha', '25'); 
        end

        ui_utility.setproperty_by_path(frame_bottom_view.bottom_helper_area_id_, 
            "PluginToolPanelCtn",'Background', bottom_color);
        ui_utility.setproperty_by_id(frame_bottom_view.bottom_server_info_ctn_id_, 
            'Background', bottom_color);
        ui_utility.setproperty_by_id(frame_bottom_view.bottom_branch_info_ctn_id_, 
            'Background', bottom_color);
        ui_utility.setproperty_by_id(frame_bottom_view.status_operation_id_, 
            'Background', bottom_color);
    end;

    on_start_update_btn_hover = function(uilib, control_id, x, y)
        base_utility.log("[frame_bottom_view]on_start_update_btn_hover");
        local game_state = frame_bottom_view.get_current_game_state();
        if frame_bottom_view.is_show_plugin_panel() == false then
            state_operation_panel.refresh_normal_state_bg(game_state);
        end;
        if game_state == ierd_tgp.game_library.GAME_STATE_NORMAL or
            game_state == ierd_tgp.game_library.GAME_STATE_UNKNOWN then
            local info = frame_bottom_model.get_game_user_protocol(frame_bottom_view.current_select_module_id_);
            if nil ~= info and nil ~= info.show_protocol and tonumber(info.show_protocol) == 1 and 
                false == frame_bottom_view.is_show_plugin_panel() then
                local height_tips = 0;
                local tips_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.user_protocol_tips_);
                local is_show = FALSE;
                if tips_ptr ~= nil then
                    is_show = tips_ptr:IsVisible();
                end
                local is_game_menu_show =
                    comm_center.call_service("SvrLua_Gamemenu_QueryIsShow", {});
                if is_show == FALSE and is_game_menu_show == false then
                    frame_bottom_view.show_protocol_tips(true, false);
                end 
            end
            if not frame_bottom_view.is_show_plugin_panel() and 
               not wg_frame_bottom_view.is_operate_menu_state_visible() and
                false ~= frame_bottom_model.is_all_protocol_agree(frame_bottom_view.current_select_module_id_) then
                local state_op_ctn_id = ui_utility.get_ctrl_id_by_path(
                frame_bottom_view.status_operation_id_, "StateOperationCnt");
                local tbl_data = frame_bottom_control.get_game_and_plugin_state_tbl(game_id);
                if tbl_data.game ~= nil then
                    if tbl_data.game.is_cloud_game then
                        ui_utility.setproperty_by_path(state_op_ctn_id, "OperationBtn",
                        "BackgroundHover",
                        "ONEIMAGE:bottom_bar\\with_menu\\start_hover.png;Stretch;0");
                    else
                        ui_utility.setproperty_by_path(state_op_ctn_id, "OperationBtn",
                        "BackgroundHover", 
                        "ONEIMAGE:bottom_bar\\play_hover.tfc;Stretch;0");
                    end;
                end;
            end
        end
    end;

    on_start_update_btn_leave = function(uilib, control_id, x, y)
        local state_value = frame_bottom_view.get_current_game_state();
        state_operation_panel.refresh_normal_state_bg(game_state);
        if ierd_tgp.game_library.GAME_STATE_NORMAL == state_value and 
            frame_bottom_model.is_all_protocol_agree(frame_bottom_view.current_select_module_id_) then
            local tpfui = base_utility.get_component_adapter("ITpf_ui",
                "ierd_tgp.tpf_ui.GetTPFUI();");
            if nil ~= tpfui then
                tpfui:RemoveInterval("frame_bottom_view.delay_handle_btn_leave_msg");
                tpfui:AddInterval("frame_bottom_view.delay_handle_btn_leave_msg", 100);
                base_utility.log("[frame_bottom_view]on_start_update_btn_leave");
            end
        end
    end;

    delay_handle_btn_leave_msg = function ()
        local tpfui = base_utility.get_component_adapter("ITpf_ui",
            "ierd_tgp.tpf_ui.GetTPFUI();");
        tpfui:RemoveInterval('frame_bottom_view.delay_handle_btn_leave_msg');
        local mouse_in = frame_bottom_view.is_mouse_in_tips_and_btn();
        if not mouse_in then
            local height_tips = 0;
            local tips_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.user_protocol_tips_);
            local is_show = FALSE;
            if tips_ptr ~= nil then
                is_show = tips_ptr:IsVisible();
            end
            if is_show == TRUE then
                frame_bottom_view.show_protocol_tips(false, false);
            end 
        end
    end;

    is_mouse_in_start_btn_range = function()
        local state_op_ctn_id = ui_utility.get_ctrl_id_by_path(
            frame_bottom_view.status_operation_id_, "StateOperationCnt");
        local start_update_ptr = ui_utility.get_ctrl_ptr_by_id(state_op_ctn_id);
        local lcu_btn_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.lcu_btn_id_);
        
        if start_update_ptr == nil or lcu_btn_ptr == nil then
            return false;
        end
        local rect_start_btn = start_update_ptr:GetRect(TRUE); 
        local point = ierd_tgp.tray_ui.Point:new_local();
        local tray_ui =
            base_utility.get_component_adapter("ITray_ui",
                "ierd_tgp.tray_ui.get_Tray_ui_adapter();");
        if tray_ui ~= nil then
            tray_ui:get_cursor_pos(point);
        end             
        local mouse_in = false;
        if rect_start_btn.left <= point.x and point.x <= rect_start_btn.right and
            rect_start_btn.top <= point.y and point.y <= rect_start_btn.bottom then
            mouse_in = true;
        end
        if not mouse_in then
            -- 判断是否在lcu btn里
            local rect_lcu_btn = lcu_btn_ptr:GetRect(TRUE);
            if rect_lcu_btn.left <= point.x and point.x <= rect_lcu_btn.right and
                rect_lcu_btn.top <= point.y and point.y <= rect_lcu_btn.bottom then
                mouse_in = true;
            end
        end
        return mouse_in;
    end;

    -- 显示/隐藏dlc按钮
    show_dlc_btn = function (is_show)
        plugin_tool_simple_panel.show_dlc_btn(is_show);
    end;
    
    show_dlc_mgr = function()
        plugin_tool_simple_panel.show_dlc_mgr();
    end;

    is_open_gift_download_switch = function(game_id)
        if frame_bottom_model.gift_download_switch_tbl[game_id] ~= nil then
            return frame_bottom_model.gift_download_switch_tbl[game_id];
        end
        local is_open = false;
        local module_info = banner_model.get_banner_module_info_by_game_id(game_id);
        if module_info ~= nil and module_info.download_report ~= nil then
            if module_info.download_report == 1 then
                is_open = true;
            end
        end
        
        frame_bottom_model.gift_download_switch_tbl[game_id] = is_open;
        return is_open;
    end;

    set_gift_icon_position = function()
        if frame_bottom_view.game_and_plugin_state_tbl_ ~= nil and
            frame_bottom_view.game_and_plugin_state_tbl_.game ~= nil and
                frame_bottom_view.game_and_plugin_state_tbl_.game.status ~= nil then
            local state_value = frame_bottom_view.game_and_plugin_state_tbl_.game.status;
            if ierd_tgp.game_library.GAME_STATE_DOWNLOADING == state_value or
                ierd_tgp.game_library.GAME_STATE_DOWNLOAD_PAUSED == state_value then
                local game_id = frame_bottom_view.game_and_plugin_state_tbl_.game.game_id;
                if frame_bottom_view.is_open_gift_download_switch(game_id) then
                    gift_op_panel.handle_mainframe_posithon_change(game_id);
                end
            end
        end
    end;

    handle_gift_white_list_rsp = function(event_id, json_str)
        if json_str == nil then return end
        local param_tbl = base_utility.json_to_table(json_str);
        if param_tbl ~= nil and param_tbl.is_in_white_list == 1 and param_tbl.game_id ~= nil then
            if frame_bottom_view.current_select_module_id_ == param_tbl.game_id then
                if frame_bottom_view.game_and_plugin_state_tbl_ ~= nil and
                    frame_bottom_view.game_and_plugin_state_tbl_.game ~= nil and
                        frame_bottom_view.game_and_plugin_state_tbl_.game.status ~= nil then
                    local state_value = frame_bottom_view.game_and_plugin_state_tbl_.game.status;
                    local progress = frame_bottom_view.game_and_plugin_state_tbl_.game.progress;
                    if ierd_tgp.game_library.GAME_STATE_DOWNLOADING == state_value or
                        ierd_tgp.game_library.GAME_STATE_DOWNLOAD_PAUSED == state_value then
                        local updating_downing_cnt_id = ui_utility.get_ctrl_id_by_path(
                            frame_bottom_view.status_operation_id_, "UpdatingOrDowningCnt");
                        gift_op_panel.show_gift_icon(updating_downing_cnt_id, param_tbl.game_id);
                        gift_op_panel.set_downloading_progress(param_tbl.game_id, progress);
                    end
                end
            end
        end
     end;

     set_bottom_bar_position = function(allow_delay_set)
        local pBtmDlg = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.bottom_dlg_id_);
        if pBtmDlg ~= nil and pBtmDlg:IsVisible() == TRUE then
            local mainframe_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.mainframe_id_);
            local width_mainframe = 0;
            local height_mainframe = 0;
            if mainframe_ptr ~= nil then
                local rc_mainframe = mainframe_ptr:GetRectEx(FALSE,TRUE);
                width_mainframe = rc_mainframe.right - rc_mainframe.left;
                height_mainframe = rc_mainframe.bottom - rc_mainframe.top;
            end
            if width_mainframe <= 0 or height_mainframe <= 0 then
                base_utility.log(
                "[frame_bottom_view]mainframe size is error, delay:" .. tostring(allow_delay_set), true);
                if allow_delay_set then
                    base_utility.add_interval("frame_bottom_view.delay_set_bottom_bar_position", 300);
                end
                return;
            end

            local rc = pBtmDlg:GetRectEx(FALSE,TRUE);
            rc.left = 1; --frame_bottom_view.mainframe_banner_list_width + 1;
            rc.right = width_mainframe - 1;
            rc.top = height_mainframe - frame_bottom_view.BOTTOM_BAR_HEIGHT - 1;
            rc.bottom = rc.top + frame_bottom_view.BOTTOM_BAR_HEIGHT; 
            pBtmDlg:MoveEx(rc,TRUE);
            -- 设置底栏bottom_content_pnl的宽度
            local bottom_content_id = ui_utility.get_ctrl_id_by_path(frame_bottom_view.bottom_dlg_id_, "Bottom_Content_Pnl");
            ui_utility.setproperty_by_id(bottom_content_id, 'XOffset', '0');
            ui_utility.setproperty_by_id(bottom_content_id, 'Width', tostring(rc.right - rc.left));
        end
     end;

     delay_set_bottom_bar_position = function()
         base_utility.remove_interval("frame_bottom_view.delay_set_bottom_bar_position");
         frame_bottom_view.set_bottom_bar_position(false);   -- 防止多次设置
     end;

     on_game_menu_btn_click = function(uilib, control_id, x, y)
        if frame_bottom_view.game_and_plugin_state_tbl_.game == nil then return end
        local game_id = frame_bottom_view.game_and_plugin_state_tbl_.game.game_id;

        local rc = nil;
        local control_ptr = ui_utility.get_ctrl_ptr_by_id(control_id);
        if control_ptr ~= nil then
            rc = control_ptr:GetRectEx(TRUE,TRUE);
        end
        local tbl_param = {};
        if rc ~= nil then
            tbl_param = { xoffset = rc.left, yoffset = rc.top, width = rc.right - rc.left, height = rc.bottom - rc.top, id = game_id };
        end
        local json_str = base_utility.table_to_json(tbl_param);
        event_center.send_event(game_menue_event.OPEN_GAME_MENUE, json_str);
     end;

     user_protocol_signaled = function (uilib, control_id)
        local item_id = ui_utility.get_ctrl_parent_id(control_id);
        local item_info = frame_bottom_model.cur_game_ctrl_id_2_prtcl_info[item_id];
        if nil ~= item_info then
            frame_bottom_model.update_protocol_agree_table(frame_bottom_view.current_select_module_id_, item_info.id, true);
        end
        local tbl_data = frame_bottom_control.get_game_and_plugin_state_tbl(frame_bottom_view.current_select_module_id_);
        if true == frame_bottom_control.table_is_empty(tbl_data) then return end
        frame_bottom_view.update_game_or_plugin_state(tbl_data);
     end;

     user_protocol_unsignaled = function (uilib, control_id)
        local item_id = ui_utility.get_ctrl_parent_id(control_id);
        local item_info = frame_bottom_model.cur_game_ctrl_id_2_prtcl_info[item_id];
        if nil ~= item_info then
            frame_bottom_model.update_protocol_agree_table(frame_bottom_view.current_select_module_id_, item_info.id, false);
        end
        local tbl_data = frame_bottom_control.get_game_and_plugin_state_tbl(frame_bottom_view.current_select_module_id_);
        if true == frame_bottom_control.table_is_empty(tbl_data) then return end
        frame_bottom_view.update_game_or_plugin_state(tbl_data);
     end;

     --外挂测试模式勾选事件
     cheat_test_mode_signaled = function (uilib, control_id)
        base_utility.log("[frame_bottom_view]cheat_test_mode_signaled call.");
        local item_id = ui_utility.get_ctrl_parent_id(control_id);
        -- if frame_bottom_view.cheat_test_mode_auto_signaled == true then 
        --    frame_bottom_view.cheat_test_mode_auto_signaled = false;
        --    return;
        -- end
        frame_bottom_control.set_game_cheat_test_mode(frame_bottom_view.current_select_module_id_, 1);
     end;

     cheat_test_mode_unsignaled = function (uilib, control_id)
        base_utility.log("[frame_bottom_view]cheat_test_mode_unsignaled call.");
        local item_id = ui_utility.get_ctrl_parent_id(control_id);
        frame_bottom_control.set_game_cheat_test_mode(frame_bottom_view.current_select_module_id_, 0);
     end;
     
     set_cheat_test_mode_check_state = function ()
        --[[base_utility.log("[frame_bottom_view]set_cheat_test_mode_check_state call.");
        local check_btn_ptr = ui_utility.get_ctrl_ptr_by_path(frame_bottom_view.mainframe_id_,
            "Ctn_BottomBar\\Dlg_Bottom\\Bottom_Content_Pnl\\Ctn_BottomArea\\Bottom_ServersInfo_Area\\pnlItem\\CbxCheatTestMode");
        if check_btn_ptr == nil then
            base_utility.log("[frame_bottom_view]set_cheat_test_mode_check_state, check_btn_ptr is nil.");
            return;
        end
        local anti_cheat_type = frame_bottom_control.get_game_anti_cheat_type(frame_bottom_view.current_select_module_id_);
        base_utility.log("[frame_bottom_view]set_cheat_test_mode_check_state,anti_cheat_type is " .. tostring(anti_cheat_type));
        if anti_cheat_type ~= 0 then 
            check_btn_ptr:Show(TRUE);
            local checked_value =
                frame_bottom_control.get_game_cheat_test_mode(frame_bottom_view.current_select_module_id_);
            if checked_value == 1 then
                --frame_bottom_view.cheat_test_mode_auto_signaled = true;
                check_btn_ptr:SetChecked(TRUE);
            else
                check_btn_ptr:SetChecked(FALSE);
            end
        else
            check_btn_ptr:Show(FALSE);
        end]]--
        frame_bottom_control.get_game_cheat_test_mode(frame_bottom_view.current_select_module_id_);
     end;

     click_user_protocol_btn = function (uilib, control_id)
        local item_id = ui_utility.get_ctrl_parent_id(control_id);
        local item_info = frame_bottom_model.cur_game_ctrl_id_2_prtcl_info[item_id];
        if nil ~= item_info and nil ~= item_info.url and "" ~= item_info.url then
            web_utility.open_new_browser(item_info.url, true, false, true);
        end
     end;

     click_private_protocol_btn = function ()
        local info = frame_bottom_model.get_game_user_protocol(frame_bottom_view.current_select_module_id_);
        if nil ~= info and nil ~= info.private_url and "" ~= info.private_url then
            web_utility.open_new_browser(info.private_url, true, false, true);
        end
     end;

     OnQueryIsProtocalTipsShow = function()
        return frame_bottom_view.is_protocal_tips_show_;
     end;

     OnShowProtocalTips = function(param)
        if param ~= nil and param.show ~= nil then
            frame_bottom_view.show_protocol_tips(param.show, false);
        end;
     end;

     show_protocol_tips = function (is_show, need_animation)
        local state_op_ctn_id = ui_utility.get_ctrl_id_by_path(
            frame_bottom_view.status_operation_id_, "StateOperationCnt");
        local start_update_id = ui_utility.get_ctrl_id_by_path(
            state_op_ctn_id, "OperationBtn");
        local start_update_ptr = ui_utility.get_ctrl_ptr_by_id(start_update_id);
        local tips_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.user_protocol_tips_);
        local mainframe_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.mainframe_id_);
        local info = frame_bottom_model.get_game_user_protocol(frame_bottom_view.current_select_module_id_);

        if nil ~= mainframe_ptr and nil ~= start_update_ptr and nil ~= tips_ptr then
            if nil == info or nil == info.protocol_list then
                frame_bottom_view.is_protocal_tips_show_ = false;
                tips_ptr:Show(FALSE);
                return;
            end
            local item_count = #info.protocol_list;
            ui_utility.setproperty_by_id(frame_bottom_view.user_protocol_tips_, 
                                        "Height", tostring(44 + (item_count - 1) * 24));
            ui_utility.setproperty_by_path(frame_bottom_view.user_protocol_tips_, 
                                        "ProtocolList", "Height", tostring(23 * item_count));
            local mainframe_rc = mainframe_ptr:GetRectEx(TRUE,TRUE);
            local start_update_rc = start_update_ptr:GetRectEx(TRUE,TRUE);
            local tips_rc = tips_ptr:GetRectEx(TRUE,TRUE);
            start_update_rc.left = start_update_rc.left - mainframe_rc.left;
            start_update_rc.top = start_update_rc.top - mainframe_rc.top;
            local h = tips_rc.bottom - tips_rc.top;
            if true == is_show then
                local list_ptr = ui_utility.get_ctrl_ptr_by_path(frame_bottom_view.mainframe_id_, "Dlg_Game_User_Protocol\\ProtocolList");
                local id = ui_utility.get_ctrl_id_by_path(frame_bottom_view.mainframe_id_, "Dlg_Game_User_Protocol\\UIMessageSpy_User_Protocol");
                if nil == list_ptr then
                    frame_bottom_view.is_protocal_tips_show_ = false;
                    tips_ptr:Show(FALSE);
                    return;
                end
                local highlight_color = "RGB:255,200,0";
                if base_utility.is_type_of_oversea_ver() then
                    highlight_color = "RGB:25,178,255";
                end
                list_ptr:SetItemCount(item_count);
                local color_data_config = comm_center.call_service("SvrTGPConfigMgr_GetColorMode", {});
                local sText = "0xD3D3D4";
                if color_data_config ~= nil and color_data_config.color_mode ~=nil then
                    if color_data_config.color_mode == MainCommon.color_mode.kLight then
                        sText = "0x5f5f5f";
                    end;
                end;
                frame_bottom_model.cur_game_ctrl_id_2_prtcl_info = {};
                for id = 0, item_count - 1 do
                    local item_id = list_ptr:GetItemRootIDByIdx(id);
                    frame_bottom_model.cur_game_ctrl_id_2_prtcl_info[item_id] = info.protocol_list[id + 1];
                    local protocol_btn_id = ui_utility.get_ctrl_id_by_path(item_id, "Btn_JumpUrl");
                    ui_utility.setproperty_by_id(protocol_btn_id, "Caption", info.protocol_list[id + 1].name);
                    ui_utility.setproperty_by_id(protocol_btn_id, "TextColor", highlight_color);
                    ui_utility.setproperty_by_id(protocol_btn_id, "TextColorHover", highlight_color);
                    ui_utility.setproperty_by_id(protocol_btn_id, "TextColorPressed", highlight_color);
                    local protocol_check_btn_ptr = ui_utility.get_ctrl_ptr_by_path(item_id, "CbxUserProtocol");
                    protocol_btn_id = ui_utility.get_ctrl_id_by_path(item_id, "CbxUserProtocol");
                    ui_utility.setproperty_by_id(protocol_btn_id, "TextColor", sText);
                    ui_utility.setproperty_by_id(protocol_btn_id, "TextColorHover", sText);
                    ui_utility.setproperty_by_id(protocol_btn_id, "TextColorPressed", sText);

                    if nil ~= protocol_check_btn_ptr then
                        if frame_bottom_model.is_protocol_check(frame_bottom_view.current_select_module_id_, info.protocol_list[id + 1].id) then
                            protocol_check_btn_ptr:SetCheckedNoSignal(TRUE);
                        else
                            protocol_check_btn_ptr:SetCheckedNoSignal(FALSE);
                        end
                    end
                end

                frame_bottom_view.is_protocal_tips_show_ = true;
                -- 移到合适的位置
                if true == need_animation then
                    tips_ptr:Show(TRUE);

                    -- 位移动画
                    local start_pos = POINT:new_local();
                    start_pos.x = start_update_rc.left - 8;
                    start_pos.y = start_update_rc.top;

                    local end_pos = POINT:new_local();
                    end_pos.x = start_pos.x;
                    end_pos.y = start_pos.y - h;

                    animation_utility.init(
                        frame_bottom_view.user_protocol_tips_,
                        "LCU_Btn_Move", animation_utility.ANI_TYPE.ANI_MOVE);
                    animation_utility.move_animation(
                        frame_bottom_view.user_protocol_tips_, start_pos, end_pos, 4, 0);
                else
                    tips_ptr:Show(TRUE);
                end

            else
                frame_bottom_view.is_protocal_tips_show_ = false;
                if true == need_animation then
                    -- 位移动画
                    local start_pos = POINT:new_local();
                    start_pos.x = start_update_rc.left - 8;
                    start_pos.y = start_update_rc.top - h;

                    local end_pos = POINT:new_local();
                    end_pos.x = start_pos.x;
                    end_pos.y = start_update_rc.top;

                    animation_utility.init(
                        frame_bottom_view.user_protocol_tips_,
                        "LCU_Btn_Move", animation_utility.ANI_TYPE.ANI_MOVE);
                    animation_utility.move_animation(
                        frame_bottom_view.user_protocol_tips_, start_pos, end_pos, 4, 0);
                    tips_ptr:Show(FALSE);
                else
                    tips_ptr:Show(FALSE);
                end
            end
        end
     end;

     refresh_protocol_tips_status = function()
        local tips_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.user_protocol_tips_);
        if tips_ptr == nil or tips_ptr:IsVisible() ~= TRUE then
            return;
        end;
        local list_ptr = ui_utility.get_ctrl_ptr_by_path(
                         frame_bottom_view.mainframe_id_, "Dlg_Game_User_Protocol\\ProtocolList");
        if list_ptr == nil then
            return;
        end;

        local info = frame_bottom_model.get_game_user_protocol(
                          frame_bottom_view.current_select_module_id_);
        if info == nil then
            return;
        end;

        local item_count = list_ptr:GetItemCount();
        for id = 0, item_count - 1 do
            local item_id = list_ptr:GetItemRootIDByIdx(id);
            local protocol_check_btn_ptr = ui_utility.get_ctrl_ptr_by_path(item_id, "CbxUserProtocol");
            if nil ~= protocol_check_btn_ptr then
                if frame_bottom_model.is_protocol_check(
                   frame_bottom_view.current_select_module_id_, info.protocol_list[id + 1].id) then
                    protocol_check_btn_ptr:SetCheckedNoSignal(TRUE);
                else
                    protocol_check_btn_ptr:SetCheckedNoSignal(FALSE);
                end
            end
        end

        state_operation_panel.refresh_normal_state_bg(frame_bottom_view.get_current_game_state());
     end;

     on_move_animation_end = function()
        local state_op_ctn_id = ui_utility.get_ctrl_id_by_path(
            frame_bottom_view.status_operation_id_, "StateOperationCnt");
        local start_update_ptr = ui_utility.get_ctrl_ptr_by_id(state_op_ctn_id);
        local mainframe_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.mainframe_id_);
        local tips_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.user_protocol_tips_);

        if tips_ptr ~= nil and nil ~= start_update_ptr and nil ~= mainframe_ptr then
            local mainframe_rc = mainframe_ptr:GetRectEx(TRUE,TRUE);
            local start_update_rc = start_update_ptr:GetRectEx(TRUE,TRUE);
            local tips_rc = tips_ptr:GetRectEx(TRUE,TRUE);
            local tips_top = tips_rc.top - mainframe_rc.top;
            local start_update_top = start_update_rc.top - mainframe_rc.top;
            if tips_top > start_update_top then
                frame_bottom_view.is_protocal_tips_show_ = true;
                tips_ptr:Show(TRUE);
            else
                frame_bottom_view.is_protocal_tips_show_ = false;
                tips_ptr:Show(FALSE);
            end
        end
    end;

     is_mouse_in_tips_and_btn = function ()
        local state_op_ctn_id = ui_utility.get_ctrl_id_by_path(
            frame_bottom_view.status_operation_id_, "StateOperationCnt");
        local start_update_id = ui_utility.get_ctrl_id_by_path(
            state_op_ctn_id, "OperationBtn");
        local start_update_ptr = ui_utility.get_ctrl_ptr_by_id(start_update_id);
        local tips_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.user_protocol_tips_);

        if nil == tips_ptr or nil == start_update_ptr then
            return false;
        end

        local rect_tips = tips_ptr:GetRect(TRUE); 
        local point = ierd_tgp.tray_ui.Point:new_local();
        local tray_ui =
            base_utility.get_component_adapter("ITray_ui",
                "ierd_tgp.tray_ui.get_Tray_ui_adapter();");
        if tray_ui ~= nil then
            tray_ui:get_cursor_pos(point);
        end             
        local mouse_in = false;
        if rect_tips.left <= point.x and point.x <= rect_tips.right and
            rect_tips.top <= point.y and point.y <= rect_tips.bottom then
            mouse_in = true;
        end

        if not mouse_in then
            -- 判断是否在btn里
            local rect_btn = start_update_ptr:GetRect(TRUE);
            if rect_btn.left <= point.x and point.x <= rect_btn.right and
                rect_btn.top <= point.y and point.y <= rect_btn.bottom then
                mouse_in = true;
            end
        end
        return mouse_in;
    end;

    on_user_protocol_tips_leave = function ()
        if false == frame_bottom_model.is_all_protocol_agree(frame_bottom_view.current_select_module_id_) then
            return;
        end
        local tpfui = base_utility.get_component_adapter("ITpf_ui",
            "ierd_tgp.tpf_ui.GetTPFUI();");
        if nil ~= tpfui then
            tpfui:RemoveInterval("frame_bottom_view.delay_handle_btn_leave_msg");
            tpfui:AddInterval("frame_bottom_view.delay_handle_btn_leave_msg", 100);
            base_utility.log("[frame_bottom_view]on_start_update_btn_leave");
        end

    end;

    move_bottom_dlg = function ()
        local dlg_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.bottom_dlg_id_ );
        if nil == dlg_ptr then
            return;
        end
        local dlg_rc = dlg_ptr:GetRectEx(TRUE,TRUE);
        dlg_rc.left = dlg_rc.left - 1;
        dlg_ptr:MoveEx(dlg_rc,TRUE);
    end;

    on_repair_btn_click = function (uilib, control_id)
        local data  = {game_id = plugin_tool_panel.cur_game_id};
        local zTemp = comm_center.call_service("Svr_GameRepair", data);

        if (nil ~= zTemp["result"]) then
            local   nResult = tonumber(zTemp["result"]);

            if (0 == nResult) then
                base_utility.log("[GameRepair]Game repaire success.");
                return;
            end;

            base_utility.log("[GameRepair]Game repaire error:" .. tostring(nResult));

            local tipParam =
            {
                position = "center",
                title = LoadStr("FRAME_BOTTOM_TIPS"),
                width = 480,
                height = 230,
                titleIcon = "",
                icon = "",
                tipsIcon = poptips_icons.kWarning,
                descTitle = "",
                desc = LoadStr("FRAME_BOTTOM_LACK_OF_REPAIRE"),
                okBtn = 
                {
                    visible = "true",
                    text = LoadStr("FRAME_BOTTOM_CONFIRM"),
                    handle = function()
                        poptips_control.close_tips();
                    end
                },
                cancelBtn = 
                {
                    visible = "false",
                    text = LoadStr("FRAME_BOTTOM_CANCEL"),
                    handle = function()
                    end
                }
            }
            poptips_control.show_tips(tipParam);
        else
            base_utility.log("[GameRepair]Result field not find.");
        end;
    end;

    on_btn_select_lsp_click = function (uilib, control_id)
        local menu_id = ui_utility.get_ctrl_id_by_path(wegame_mainframe_view.dialog_id, "WinMenu_ISP");

        local color_data_config = comm_center.call_service("SvrTGPConfigMgr_GetColorMode", {});
        if color_data_config ~= nil and color_data_config.color_mode ~=nil and 
            color_data_config.color_mode== MainCommon.color_mode.kLight then
            menu_id = ui_utility.get_ctrl_id_by_path(wegame_mainframe_view.dialog_id, "WinMenu_LightISP");
        end;

        local btn_tab_ptr = ui_utility.get_ctrl_ptr_by_id(control_id);
        local menu_ptr = ui_utility.get_ctrl_ptr_by_id(menu_id);
        if nil == btn_tab_ptr or nil == wegame_mainframe_view.dialog_ptr or nil == menu_ptr then
            return;
        end
        local btn_tab_rc = btn_tab_ptr:GetRectEx(TRUE,TRUE);
        local mainframe_rc =  wegame_mainframe_view.dialog_ptr:GetRectEx(TRUE,TRUE);
        local menu_rc = menu_ptr:GetRectEx(TRUE,TRUE);
        local btn_w = btn_tab_rc.right - btn_tab_rc.left;
        local menu_w = menu_rc.right - menu_rc.left;
        local offset_x = btn_tab_rc.left - mainframe_rc.left + frame_bottom_view.MENU_OFFSET_X;
        local offset_y = btn_tab_rc.top - mainframe_rc.top - frame_bottom_view.MENU_OFFSET_Y;

        tiandao_isp_menu.show(menu_id, true, offset_x, offset_y);
    end;

    show_contract_no_check_tips = function (is_show)
        if base_utility.CLIENT_TYPE.OVERSEA_VER == base_utility.get_client_version_type() then
            -- 海外版不做处理
            return;
        end;

        local tips_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.user_protocol_tips_);
        if nil == frame_bottom_view.prtcl_no_check_tips_ptr_ or 
            nil == tips_ptr then
            return;
        end

        if is_show then
            local tips_rc = tips_ptr:GetRectEx(FALSE,TRUE);
            local no_check_tips_rc = frame_bottom_view.prtcl_no_check_tips_ptr_:GetRectEx(TRUE,TRUE);
            local no_check_tips_w = no_check_tips_rc.right - no_check_tips_rc.left;
            local no_check_tips_h = no_check_tips_rc.bottom - no_check_tips_rc.top;
            no_check_tips_rc.left = tips_rc.left;
            no_check_tips_rc.right = no_check_tips_rc.left + no_check_tips_w;
            no_check_tips_rc.top = tips_rc.top - no_check_tips_h + 14;
            no_check_tips_rc.bottom = no_check_tips_rc.top + no_check_tips_h;
            frame_bottom_view.prtcl_no_check_tips_ptr_:MoveEx(no_check_tips_rc,TRUE);
            frame_bottom_view.prtcl_no_check_tips_ptr_:Show(TRUE); 
        else
            frame_bottom_view.prtcl_no_check_tips_ptr_:Show(FALSE);   
        end
    end;

    is_assistant_visible = function(game_id)
        if game_id ~= frame_bottom_view.current_select_module_id_ then
            return false;
        end
        local base_info = banner_model.get_game_base_info(game_id);
        if base_info == nil then  
            return false;
        end;

        local ctn_ctrl = Tenio.INVALID_CONTROLID;
        local btn_ctrl = Tenio.INVALID_CONTROLID;

        if base_info.type == ierd_tgp.game_library.GAME_LIST_TYPE_CONSOLE then
            ctn_ctrl = ui_utility.get_ctrl_id_by_path(frame_bottom_view.bottom_helper_area_id_,
                            "PluginToolSimplePanelCtn\\StandAloneGameCtn");
            if ctn_ctrl == Tenio.INVALID_CONTROLID then
                return false;
            end
            btn_ctrl = ui_utility.get_ctrl_id_by_path(ctn_ctrl, "BtnCrossSetting");

        else
            ctn_ctrl = ui_utility.get_ctrl_id_by_path(frame_bottom_view.bottom_helper_area_id_,
                            "PluginToolPanelCtn");
            if ctn_ctrl == Tenio.INVALID_CONTROLID then
                return false;
            end
            btn_ctrl = ui_utility.get_ctrl_id_by_path(ctn_ctrl, "CtnMixBtns\\BtnAssistSetting");
        end

        if ctn_ctrl == Tenio.INVALID_CONTROLID or
            btn_ctrl == Tenio.INVALID_CONTROLID then
            return false;
        end;

        return ui_utility.is_visible(ctn_ctrl) and ui_utility.is_visible(btn_ctrl);
    end;

    move_proticol_tips = function ()
        local dialog_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.mainframe_id_);
        local tips_ptr = ui_utility.get_ctrl_ptr_by_id(frame_bottom_view.user_protocol_tips_);
        if nil ~= dialog_ptr and nil ~= tips_ptr then
            local dialog_rect = dialog_ptr:GetRectEx(TRUE, TRUE);
            local tips_rect = tips_ptr:GetRectEx(TRUE, TRUE);
            local tips_height = tips_rect.bottom - tips_rect.top;
            local tips_width = tips_rect.right - tips_rect.left;
            tips_rect.top = dialog_rect.bottom - dialog_rect.top - 60 - tips_height;
            tips_rect.bottom = tips_rect.top + tips_height;
            tips_rect.left = dialog_rect.right - dialog_rect.left - tips_width - 2;
            tips_rect.right = tips_rect.left + tips_width;

            tips_ptr:MoveEx(tips_rect, TRUE);
        end
    end;

    show_server_zone_select_ui = function(to_show)
        local show_str = "false";
        if true == to_show then
            show_str = "true";
        end
        ui_utility.setproperty_by_id(frame_bottom_view.bottom_server_info_id_, "Visible", show_str);
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
                                       "CntZoneButtons", "Visible", show_str);
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
                                       "ZoneName", "Visible", show_str);
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, 
                                       "CntIcons", "Visible", show_str);
        if true ~= to_show then
            ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_,
                                           "delayTime", "Visible", "false");
        end
    end;

    on_cloud_game_state_changed = function(param)
        if param == nil or param.game_id == nil or param.state == nil  then
            base_utility.log("[frame_bottom_view]change_cloud_game_state, param error");
            return;
        end;
        if tonumber(param.game_id) ~= frame_bottom_view.current_select_module_id_ then
            base_utility.log("[frame_bottom_view]change_cloud_game_state, not current game");
            return;
        end;
        frame_bottom_view.current_cloud_game_config = param;
        if true == frame_bottom_view.hidden_zone_ui_but_support then
            frame_bottom_view.show_server_zone_select_ui(true);
            frame_bottom_view.set_status_operation_area_width();
            frame_bottom_view.set_server_info_status(true);
        end
    end;

    on_try_launch_cloud_game = function(param)
        if nil == param or nil == param.game_id or nil == param.plugin_id then
            return;
        end
        local game_id = param.game_id;
        local game_lib = base_utility.get_component_adapter("IGame_library",
                                            "ierd_tgp.game_library.Get_game_library_adapter();");
        local support_zone_select = game_lib:is_zone_select_support(game_id);
        local server_id = 0;
        if support_zone_select then
            local game_servers = banner_model.get_game_servers(game_id);
            if game_servers ~= nil and game_servers.selleted ~= nil then
                server_id = game_servers.selleted;
            end
            if server_id == 0 then
                -- 打开选区面板
                base_utility.log("server_id is nil, open dir_ui");
                comm_center.call_service('Svr_ShowZoneChose',
                { game_id = game_id, uin = login_model.main_uin });
                return;
            end;
        end;
        local launch_param = {
            cloud_channel_id = param.plugin_id,
            game_id = param.game_id,
            zone_id = server_id
        };
        comm_center.call_service('Svr_LaunchCloudGame', launch_param);
    end;

    on_color_mode_update = function(data)
        if nil == data or nil == data.color_mode then
            return;
        end
        base_utility.log("[frame_bottom_view]on_color_mode_update: " .. tostring(data.color_mode), true);
        local color_mode = data.color_mode;
        
        frame_bottom_view.color_text_ = "0xA4A4A4";
        if color_mode == MainCommon.color_mode.kLight then
            frame_bottom_view.color_text_ = "0x3c3c3c";
        end;

        if color_mode == MainCommon.color_mode.kLight then
            ui_utility.setproperty_by_id(frame_bottom_view.bottom_dlg_id_, "Background", 
                                         frame_bottom_view.FRAME_BOTTOM_LIGHT_COLOR);
        else
            ui_utility.setproperty_by_id(frame_bottom_view.bottom_dlg_id_, "Background", 
                                         frame_bottom_view.FRAME_BOTTOM_DARK_COLOR);
        end;
        frame_bottom_view.color_mode_ = color_mode;

        if frame_bottom_view.bottom_server_info_id_ == nil then
            return;
        end;
        frame_bottom_view.switch_color_mode(color_mode);
        ui_utility.setproperty_by_path(frame_bottom_view.bottom_server_info_id_, "ZoneName",
                    "TextColor", frame_bottom_view.color_text_);
    end;

    switch_color_mode = function(color_mode)
        base_utility.log("[frame_bottom_view]switch_color_mode: " .. tostring(color_mode), true);
        -- TODO(amadeusyu): change tpf style
        local mainframe_id = ui_utility.get_ctrl_id_by_cid(CID_MAINFRAME_Dialog_MainFrame);
        if mainframe_id == nil then
            return;
        end;
        local bottom_dlg_id = ui_utility.get_ctrl_id_by_path(mainframe_id,
                           "pnlClient\\Ctn_BottomBar\\Dlg_Bottom");
         if bottom_dlg_id == nil then
            base_utility.log("[mainframe]switch_color_mode no dlg_bottom", true);
            return;
         end;
        local bottom_dlg_ptr = ui_utility.get_ctrl_ptr_by_id(bottom_dlg_id);
        local uilib = ui_utility.uilib();
        if bottom_dlg_ptr == nil or uilib == nil then
            base_utility.log("[mainframe]switch_color_mode no dlg_bottom ptr", true);
            return;
        end;
        local sText;
        if color_mode == MainCommon.color_mode.kLight then
            sText = "light";
        else
            sText = "dark";
        end;
        local const_ui_str2, str_holder2 = U8toCUIStr(sText);
        uilib:ChangeSkinMode(const_ui_str2);
        ui_utility.setproperty_by_id(bottom_dlg_id, "SkinMode", color_mode);
        bottom_dlg_id = ui_utility.get_ctrl_id_by_path(frame_bottom_view.mainframe_id_,
                           "Dlg_Game_User_Protocol");
        ui_utility.setproperty_by_id(bottom_dlg_id, "SkinMode", color_mode);

        if color_mode == MainCommon.color_mode.kLight then
            sText = "0x5f5f5f";
        else
            sText = "0xD3D3D4";
        end;
        local info = frame_bottom_model.get_game_user_protocol(frame_bottom_view.current_select_module_id_);
        local list_ptr = ui_utility.get_ctrl_ptr_by_path(
        frame_bottom_view.mainframe_id_, "Dlg_Game_User_Protocol\\ProtocolList");
        if frame_bottom_view.is_protocal_tips_show_ and info ~=nil and list_ptr ~= nil then
            local item_count = #info.protocol_list;
            for id = 0, item_count - 1 do
                local item_id = list_ptr:GetItemRootIDByIdx(id);
                local protocol_btn_id = ui_utility.get_ctrl_id_by_path(item_id, "CbxUserProtocol");
                ui_utility.setproperty_by_id(protocol_btn_id, "TextColor", sText);
                ui_utility.setproperty_by_id(protocol_btn_id, "TextColorHover", sText);
                ui_utility.setproperty_by_id(protocol_btn_id, "TextColorPressed", sText);
            end;
        end;
    end;
};
